<?php
namespace Dingo\Api\Auth\Provider;

use Illuminate\Support\Str;
use Illuminate\Http\Request;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;

abstract class Authorization implements \Dingo\Api\Contract\Auth\Provider {
    protected $options = [];

    public function validateAuthorizationHeader(Request $request) {
        if ( Str::startsWith(strtolower($request->headers->get('authorization')), $this->getAuthorizationMethod()) ) return true;

        throw new BadRequestHttpException;
    }

    abstract public function getAuthorizationMethod();
}
